From: Giovanni Campagna Date: Sat, 12 Mar 2011 22:27:57 +0000 (+0100) Subject: StTextureCache: generate icon names in the right order X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~8693 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=057348763b674c075f803122856c58ff338f67ff;p=gnome-shell.git StTextureCache: generate icon names in the right order GThemedIcon expects the first name to be the most specific, and will thus prefer it to later ones. We thus need to order the names from the longer to the shorter. https://bugzilla.gnome.org/show_bug.cgi?id=621707 --- diff --git a/src/st/st-texture-cache.c b/src/st/st-texture-cache.c index 405cc177a..198ddf273 100644 --- a/src/st/st-texture-cache.c +++ b/src/st/st-texture-cache.c @@ -1398,10 +1398,11 @@ static char ** symbolic_names_for_icon (const char *name) { char **parts, **names; - int i; + int i, numnames; parts = g_strsplit (name, "-", -1); - names = g_new (char *, g_strv_length (parts) + 1); + numnames = g_strv_length (parts); + names = g_new (char *, numnames + 1); for (i = 0; parts[i]; i++) { if (i == 0) @@ -1418,6 +1419,15 @@ symbolic_names_for_icon (const char *name) names[i] = NULL; g_strfreev (parts); + + /* need to reverse here, because longest (most specific) + name has to come first */ + for (i = 0; i < (numnames / 2); i++) { + char *tmp = names[i]; + names[i] = names[numnames - i - 1]; + names[numnames - i - 1] = tmp; + } + return names; }